<%@ page contentType="text/html;charset=UTF-8" language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ include file="/include/jstl.jsp" %>
<script language="javascript">
    //替换非法字符
    function repInvalidChar(sText){
        var arrInvalidChar = ["<" ,">" ,"=" ];
        var arrvalidChar   = ["＜","＞","＝"];
        var sTempChar      = "";
        for(var i=0;i<arrInvalidChar.length;i++){
            while(sText.indexOf(arrInvalidChar[i])!=-1){
                sText = sText.replace(arrInvalidChar[i],arrvalidChar[i]);
            }
        }
        return sText;
    }
    
    function replaceChar(){
        var sText = $("#RULE_DES").val();
            sText = repInvalidChar(sText);
        
        //更新对应的规则描述
        $("#RULE_DES").val(sText);
    }
</script>
<h2 class="contentTitle" style="background-color:#E8F1FD;">用户异常规则修改</h2>
<div class="pageContent" style="background-color:#E8F1FD;">
    <form method="post" action="540104.tran" onsubmit="return validateCallback(this, navTabAjaxDone)" class="pageForm required-validate">
        <input type="hidden" id="RULE_CODE" name="RULE_CODE" value="${ETF.RULE_CODE}"/>
        <input type="hidden" id="RULE_TYPE" name="RULE_TYPE" value="${ETF.RULE_TYPE}"/>
        <div class="pageFormContent" layoutH="87">
            <table>
                <tr height="30px">
                    <td>规则编号：</td>
                    <td>${ETF.RULE_CODE}</td>
                </tr>
                <tr height="30px">
                    <td>规则名称：</td>
                    <td>${ETF.RULE_NAME}</td>
                </tr>
                <tr height="30px">
                    <td>规则类型：</td>
                    <td>
                        <c:if test="${ETF.RULE_TYPE=='0'}">
                            用户
                        </c:if>
                        <c:if test="${ETF.RULE_TYPE=='1'}">
                            商户
                        </c:if>
                    </td>
                </tr>
                <tr height="30px">
                    <td>生效状态：</td>
                    <td>
                        <input type="radio" name="IS_USE" id="IS_USE" value="1" <c:if test="${ETF.IS_USE==1}">checked</c:if> >启用</input>
                        <input type="radio" name="IS_USE" id="IS_USE" value="0" <c:if test="${ETF.IS_USE==0}">checked</c:if> >禁用</input>
                    </td>
                </tr>
                <tr height="30px">
                    <td>执行频率：</td>
                    <td>
                        <select name="EXEC_RATE" id="EXEC_RATE">
                            <option value="1" <c:if test="${ETF.EXEC_RATE == 1}">selected</c:if>>天  </option>
                            <option value="2" <c:if test="${ETF.EXEC_RATE == 2}">selected</c:if>>周  </option>
                            <option value="3" <c:if test="${ETF.EXEC_RATE == 3}">selected</c:if>>月  </option>
                            <option value="4" <c:if test="${ETF.EXEC_RATE == 4}">selected</c:if>>季度</option>
                            <option value="5" <c:if test="${ETF.EXEC_RATE == 5}">selected</c:if>>年  </option>
                        </select>
                    </td>
                </tr>
                <tr height="80px">
                    <td style="vertical-align:top;">规则描述：</td>
                    <td>
                        <textarea name="RULE_DES" id="RULE_DES" cols="40" rows="5" onblur="checkChiness(this.value,'400')" class="required" value="">${ETF.RULE_DES}</textarea>
                    </td>
                </tr>
                <% int i=0;%>
                <% int paramNum1=0;%>
                <c:forEach items="${ETF.REC}" var="GRP">
                    <tr height="30px">
                        <td>阀值参数<%=++i%>：</td>
                        <td>
                            ${GRP.PARAM_NAME}                  
                            <input type="hidden" name="PARAM_NAME<%=i%>" id="PARAM_NAME" size="30" maxLength="50" class="required" readonly="readonly" value="${GRP.PARAM_NAME}"/> 
                        </td>
                    </tr>
                    <tr height="30px">
                        <td>参数值：</td>
                        <td>
                            <c:choose>
                                <c:when test="${GRP.PARAM_TYPE == '元'}">
                                    <input type="text" name="PARAM_VALUE<%=i%>" id="PARAM_VALUE" size="30" maxLength="14" class="required number" max="99999999999.99" min="0" class="number" value="<fmt:formatNumber type='currency' value='${GRP.PARAM_VALUE/100}' pattern='0.00'/>" onkeyup="value=value.replace(/[^\d]/g,'') "/> 
                                </c:when>
                                <c:when test="${GRP.PARAM_TYPE == '次'}">
                                    <input type="text" name="PARAM_VALUE<%=i%>" id="PARAM_VALUE" size="30" maxLength="9" class="required digits" value="${GRP.PARAM_VALUE}"/> 
                                </c:when>
                                <c:otherwise>
                                    <input type="text" name="PARAM_VALUE<%=i%>" id="PARAM_VALUE" size="30" maxLength="9" class="required" value="${GRP.PARAM_VALUE}"/> 
                                </c:otherwise>
                            </c:choose>                  
                        </td>
                    </tr>
                    <tr height="30px">
                        <td>参数类型：</td>
                        <td>
                            ${GRP.PARAM_TYPE}
                            <input type="hidden" name="PARAM_TYPE<%=i%>" id="PARAM_TYPE" size="30" maxLength="20" readonly="readonly" value="${GRP.PARAM_TYPE}"/>
                            <input type="hidden" id="paramNum1" name="paramNum1" value="<%=paramNum1++%>"/> 
                        </td>
                    </tr>    
                </c:forEach>
                <input type="hidden" id="paramNum" name="paramNum" value="<%=paramNum1%>"/>
            </table>
        </div>
        <div class="formBar">
            <ul>
                <li><div class="buttonActive"><div class="buttonContent"><button type="submit" onclick="replaceChar()">确定</button></div></div></li>
                <li><div class="button"><div class="buttonContent"><button type="reset">重置</button></div></div></li>
                <li><div class="buttonActive"><div class="buttonContent"><button type="button" class="close" >返回</button></div></div></li>
            </ul>
        </div>
    </form>
</div>